In [1]:
%matplotlib notebook
import seaborn as sns
sns.set_context('notebook')
In [2]:
from pathlib import Path
datadir = Path('/Users/klay6683/data/iuvs')
hk = pd.read_hdf(str(datadir / 'HK_DB.h5'), 'df')
In [3]:
l1ascan = pd.read_hdf(str(datadir / 'l1a_dark_scan.h5'), 'df')
In [4]:
from iuvs import meta
In [5]:
l1ascan = meta.clean_up_dark_scan(l1ascan)
In [6]:
l1ascan.set_index('TIME_OF_INT', inplace=True)
In [7]:
l1ascan.index
Out[7]:
In [8]:
l1ascan = l1ascan.sort_index()
In [9]:
l1ascan.loc[(l1ascan.index.year==2015) & (l1ascan.CHANNEL=='MUV'), 'DET_TEMP'].head()
Out[9]:
In [10]:
hk.loc['2015-01-01 00:20', 'MUV_DET_TEMP_C'].head()
Out[10]:
In [11]:
timeres = '10min'
df = hk.resample(timeres).dropna(how='all')
std = hk.resample(timeres, how='std').dropna(how='all')
In [12]:
muv = l1ascan[l1ascan.CHANNEL=='MUV']
muvresamp = muv.resample(timeres).dropna(how='all')
muverrors = muv.resample(timeres, how='std').dropna(how='all')
In [13]:
muvresamp.DET_TEMP.size
Out[13]:
fig, ax = plt.subplots() muvresamp.DET_TEMP.plot(style='*', markersize=7, ax=ax, label='CHIP') # yerr=muverrors) df.MUV_DET_TEMP_C.plot(style='o', markersize=7, ax=ax, label='HK') # yerr=std) plt.legend(loc='best')
In [14]:
muverrors.DET_TEMP.size
Out[14]:
In [29]:
from bokeh.plotting import figure, output_notebook, show, output_file, vplot
from bokeh.models import Range1d
In [42]:
output_notebook()
output_file('/Users/klay6683/Dropbox/DDocuments/IUVS/plots/HK_CHIP_comparison.html',
title='HK vs CHIP, Temperature comparison')
In [17]:
from bokeh.models.formatters import DatetimeTickFormatter
dtfmt = DatetimeTickFormatter(
formats=dict(
hours=["%H:%M"],
days=["%Y-%m-%d"],
months=["%b %Y"],
years=["%b %Y"],
)
)
In [18]:
from bokeh.palettes import Spectral3
In [19]:
Spectral3
Out[19]:
In [24]:
ratio = muvresamp.DET_TEMP / df.MUV_DET_TEMP_C
In [37]:
muvresamp['ratio'] = ratio
muvresamp['diff'] = muvresamp.DET_TEMP - df.MUV_DET_TEMP_C
In [43]:
p = figure(width=800, height=400, x_axis_type="datetime",
title='CHIP vs HK Detector Temperature')
shared_x = muvresamp.index
# MUV data
p.line(shared_x, muvresamp.DET_TEMP, legend='CHIP_DET_TEMP',
line_width=2, color=Spectral3[0])
p.circle(shared_x, muvresamp.DET_TEMP, color=Spectral3[0],
fill_color='white', size=8)
# HK data
p.line(df.index, df.MUV_DET_TEMP_C, color=Spectral3[-1], legend='HK_MUV_DET_TEMP',
line_width=2)
p.circle(df.index, df.MUV_DET_TEMP_C, color=Spectral3[-1], fill_color='white',
size=8)
p3 = figure(width=800, height=400, x_axis_type='datetime',
title='Delta between those 2 temperatures.')
p3.circle(shared_x, muvresamp['diff'], legend='diff(CHIP / HK)', size=5,
color='green')
for fig in [p,p3]:
fig.axis[0].formatter = dtfmt
fig.background_fill = 'beige'
all_ = vplot(p,p3)
show(all_)
In [26]:
dtaxis = p.axis[0]
In [35]:
dtaxis.formatter
Out[35]:
In [ ]:
df.MUV_DET_TEMP_C.size
In [ ]:
fig, ax = plt.subplots(nrows=2, figsize=(10,10))
df.filter(regex='^MUV_').plot(ax=ax[0], yerr=std)
df.filter(regex='^MUV_').plot(ax=ax[1], yerr=std)
# df.filter(regex='^IUVS_._TEMP_C').plot(ax=ax[2],yerr =std)
plt.tight_layout()
In [ ]:
df.columns
In [ ]:
df.filter(regex='^IUVS_._TEMP_C').plot(yerr=std, subplots=True)
In [ ]:
In [ ]:
In [ ]:
g = sns.PairGrid(df.filter(regex='IUVS_._TEMP_C'))
g.map_diag(sns.kdeplot)
g.map_offdiag(sns.kdeplot, cmap="Blues_d", n_levels=6)
In [ ]:
In [ ]:
In [ ]:
tips = sns.load_dataset('tips')
In [ ]:
tips.head()
In [ ]:
tips.day.value_counts().index
In [ ]:
attend = sns.load_dataset('attention').query('subject <=12')
In [ ]:
attend
In [ ]: